package com.party.core.model.copartner;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * @author: Administrator.
 * @Description: 佣金状态枚举
 * @Date:Created in 2017/10/24 0024 下午 16:57.
 */
public enum BrokerageStatusEnum {
    ONE_MONEY_AUDITING(1, "金额待审核"),

    ONE_MONEY_AUDIT_PASS(2, "金额已通过"),

    ONE_MONEY_AUDIT_REJECT(3, "金额已拒绝"),

    TWO_FREEZE(4, "已冻结"),

    TWO_WITHDRAW(5, "可提现"),

    TWO_REJECT(6, "已拒绝");

    /**
     * 状态码
     */
    private Integer code;

    /**
     * 状态值
     */
    private String value;

    BrokerageStatusEnum(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    /**
     * 根据状态码获取状态值
     *
     * @param code 状态码
     * @return 状态值
     */
    public static String getValue(Integer code) {
        for (BrokerageStatusEnum orderType : BrokerageStatusEnum.values()) {
            if (orderType.getCode().equals(code)) {
                return orderType.getValue();
            }
        }
        return null;
    }

    /**
     * 枚举类型转换为map
     *
     * @return 转换后的map
     */
    public static Map<Integer, String> convertMap() {
        Map<Integer, String> map = Maps.newHashMap();
        for (BrokerageStatusEnum orderType : BrokerageStatusEnum.values()) {
            map.put(orderType.getCode(), orderType.getValue());
        }
        return map;
    }


    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
